package com.rzico.order.enumx;

/**
 * Created by icssh on 2020/4/11.
 */
public enum OrderLogTypeEnum {

    /**
     * 类型（0.创建,1.修改,2.确认,3.付款,4.退款,5.发货,6.退货,7.完成,8.取消,9.其他）
     */
    ORDER_LOG_TYPE_CREATE(0, "创建"),
    ORDER_LOG_TYPE_MODIFY(1, "修改"),
    ORDER_LOG_TYPE_CONFIRM(2, "确认"),
    ORDER_LOG_TYPE_PAYEMNT(3, "付款"),
    ORDER_LOG_TYPE_REFUND(4, "退款"),
    ORDER_LOG_TYPE_SHIPPING(5, "发货"),
    ORDER_LOG_TYPE_RETURN(6, "退货"),
    ORDER_LOG_TYPE_COMPLETE(7, "完成"),
    ORDER_LOG_TYPE_CANCEL(8, "取消"),
    ORDER_LOG_TYPE_OTHER(9, "取消");

    private Integer id;
    private String name;

    OrderLogTypeEnum(Integer id, String name) {
        this.id = id;
        this.name = name;
    }

    public Integer getId() {
        return this.id;
    }

    public String getName() {
        return this.name;
    }

    public static String getNameById(Integer id){
        if (id == null) {
            return null;
        }
        OrderLogTypeEnum anEnum = getById(id);
        if (anEnum == null) {
            return null;
        }
        return anEnum.getName();
    }

    public static OrderLogTypeEnum getById(Integer id) {
        for (OrderLogTypeEnum anEnum : values()) {
            if (anEnum.getId().equals(id)) {
                return anEnum;
            }
        }
        return null;
    }

    public static void main(String args[]){
        System.out.println(OrderLogTypeEnum.getNameById(1));
    }
}
